package com.tangbuzhi.bridge;

/**
 * 桥接模式
 */
public class Bridge {
    public interface Implementor {
        void opration();
    }

    public static class ConcreteImplementorA implements Implementor {
        @Override
        public void opration() {
            //具体逻辑
        }
    }

    public static class ConcreteImplementorB implements Implementor {
        @Override
        public void opration() {
            //具体逻辑
        }
    }

    public abstract class Abstraction {
        private Implementor implementor;

        public Abstraction(Implementor implementor) {
            this.implementor = implementor;
        }

        public void opration() {
            implementor.opration();
        }
    }

    public class RefinedAbstraction extends Abstraction {
        public RefinedAbstraction(Implementor implementor) {
            super(implementor);
        }

        public void refinedOperation() {
            System.out.println("this is refined menthod");
        }
    }

    public static void main(String[] args) {
        //客户端调用逻辑
    }
}
